#include <stdlib.h>
#include <time.h>
#include <stdio.h>

void GetA64bitRandomNumber (int GK[64]);

void main ()
{
    int n;
    int GK[64]= {-1};
    printf("The 64 bit binary random sequence\n");
    for(n=0; n<64; n++)
    {
        GK[n]=-1;
        printf("%d ",GK[n]);
        if((n+1)%8==0)
        {
            printf("\n");
        }
    }

    GetA64bitRandomNumber(GK);
    printf("The 64 bit binary random sequence\n");
    for(n=0; n<64; n++)
    {
        printf("%d ",GK[n]);
        if((n+1)%8==0)
        {
            printf("\n");
        }
    }
}
void GetA64bitRandomNumber (int GK[64])
{
    FILE *fp;
    char character;
    int count,count1;
    int temp;

    if((fp=fopen("E://test.txt","rb"))==NULL)
    {
        printf("Open the random file failed\n");
        exit(0);
    }

    count=0;
    count1=0;
    printf("the characters read from file:\n");
    while((character=fgetc(fp))!=EOF && count<64)
    {
        if(isprint(character))
        {

            printf("%4c%4d",character,character);
            if((count1+1)%8==0)
            {
                printf("\n");
            }
            count1++;
            switch(character)
            {
            case 69:
                GK[count]=1;
                count++;
                break;
            case 101:
                GK[count]=1;
                count++;
                break;

            case 65:
                GK[count]=1;
                count++;
                break;
            case 97:
                GK[count]=1;
                count++;
                break;

            case 73:
                GK[count]=1;
                count++;
                break;
            case 105:
                GK[count]=1;
                count++;
                break;

            case 82:
                GK[count]=1;
                count++;
                break;
            case 114:
                GK[count]=1;
                count++;
                break;

            case 72:
                GK[count]=1;
                count++;
                break;
            case 104:
                GK[count]=1;
                count++;
                break;

            case 67:
                GK[count]=1;
                count++;
                break;
            case 99:
                GK[count]=1;
                count++;
                break;

            case 77:
                GK[count]=1;
                count++;
                break;
            case 109:
                GK[count]=1;
                count++;
                break;

            case 85:
                GK[count]=1;
                count++;
                break;
            case 117:
                GK[count]=1;
                count++;
                break;

            case 74:
                GK[count]=1;
                count++;
                break;
            case 106:
                GK[count]=1;
                count++;
                break;

            case 86:
                GK[count]=1;
                count++;
                break;
            case 118:
                GK[count]=1;
                count++;
                break;

            case 84:
                GK[count]=0;
                count++;
                break;
            case 116:
                GK[count]=0;
                count++;
                break;

            case 79:
                GK[count]=0;
                count++;
                break;
            case 111:
                GK[count]=0;
                count++;
                break;

            case 78:
                GK[count]=0;
                count++;
                break;
            case 110:
                GK[count]=0;
                count++;
                break;

            case 83:
                GK[count]=0;
                count++;
                break;
            case 115:
                GK[count]=0;
                count++;
                break;

            case 68:
                GK[count]=0;
                count++;
                break;
            case 100:
                GK[count]=0;
                count++;
                break;

            case 76:
                GK[count]=0;
                count++;
                break;
            case 108:
                GK[count]=0;
                count++;
                break;

            case 80:
                GK[count]=0;
                count++;
                break;
            case 112:
                GK[count]=0;
                count++;
                break;

            case 70:
                GK[count]=0;
                count++;
                break;
            case 102:
                GK[count]=0;
                count++;
                break;

            case 71:
                GK[count]=0;
                count++;
                break;
            case 103:
                GK[count]=0;
                count++;
                break;

            case 87:
                GK[count]=0;
                count++;
                break;
            case 119:
                GK[count]=0;
                count++;
                break;

            case 89:
                GK[count]=0;
                count++;
                break;
            case 121:
                GK[count]=0;
                count++;
                break;

            case 66:
                GK[count]=0;
                count++;
                break;
            case 98:
                GK[count]=0;
                count++;
                break;

            case 75:
                GK[count]=0;
                count++;
                break;
            case 107:
                GK[count]=0;
                count++;
                break;

            case 88:
                GK[count]=0;
                count++;
                break;
            case 120:
                GK[count]=0;
                count++;
                break;

            case 81:
                GK[count]=0;
                count++;
                break;
            case 113:
                GK[count]=0;
                count++;
                break;

            case 90:
                GK[count]=0;
                count++;
                break;
            case 122:
                GK[count]=0;
                count++;
                break;

            default:
                break;
            }

        }
    }
    printf("\n");
    fclose(fp);

}



